let url = 'http://127.0.0.1'
let request = {
	get(...args) {
		let [path, data] = args
		return new Promise((resovle, reject) => {
			wx.request({
				method: "GET",
				url: `${url}${path}`,
				data,
				header: {
					'content-type': 'application/json',
					token: 'zxcvb'
				},
				success(res) {
					resovle(res)
				},
				fail(err) {
					//console.log(err)
					reject("GET请求错误")
				}
			})
		})

	},
	post(...args) {
		let [path, data] = args
		return new Promise((resovle, reject) =>{
			wx.request({
				method: "POST",
				url: `${url}${path}`,
				data,
				header: {
					"Content-Type": "application/x-www-form-urlencoded",
				},
				success(res) {
					resovle(res)
				},
				fail(err) {
					//console.log(err)
					reject("POST请求错误")
				}
			})
		})
	}
}
module.exports = {
	request
}
